#!/bin/bash
echo "Building in bin/ directory..."
echo

WXWIN="/d/vc/wxWidgets-3.2.7"

# 确保 bin 目录存在
mkdir -p bin

# 编译到 bin/ 目录
g++ -std=c++11 -O2 -Wall -Wextra \
    -I"$WXWIN/include" \
    -I"$WXWIN/lib/wx/include/msw-unicode-3.2" \
    -D__WXMSW__ -D_UNICODE -DUNICODE \
    ai_system_improved.cpp \
    -L"$WXWIN/lib" \
    -lwxmsw32u_core_gcc_custom -lwxbase32u_gcc_custom \
    -lkernel32 -luser32 -lgdi32 -lwinspool -lcomdlg32 \
    -ladvapi32 -lshell32 -lole32 -loleaut32 -luuid \
    -lcomctl32 -lrpcrt4 -loleacc -luxtheme \
    -o bin/cbp2make_ai.exe

if [[ $? -eq 0 ]]; then
    echo "✅ Built successfully in bin/"
    echo "Executable: bin/cbp2make_ai.exe"
    
    # 创建符号链接
    ln -sf bin/cbp2make_ai.exe ./
    echo "✅ Symbolic link created: cbp2make_ai.exe -> bin/cbp2make_ai.exe"
    
    # 测试
    export PATH="$WXWIN/lib:$PATH"
    ./cbp2make_ai.exe --status
else
    echo "❌ Build failed"
fi
